using System;
using System.Collections.Generic;
using System.Text;
using log4net;

namespace GURUCORE.Framework.Core
{
    /// <summary>
    /// Base Exception of all GURUCORE Framework implementation. It contains some static method to process Exception by a unique way.
    /// </summary>
    [System.Diagnostics.DebuggerStepThrough()]
    public abstract class GException : ApplicationException
    {
        public int m_nCode;       
        
        private static readonly ILog log = LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);

        
        public GException()
        {}

        public GException(int code, string message, Exception ex) : base(message, ex)
        {
            this.m_nCode = code;            
        }

        public GException(string message, Exception ex) : this(-1, message, ex)
        { }

        public GException(string message) : this (-1, message, null)
        { }

        public static void ProcessException(Exception ex)
        {
            ProcessException("EMPTY MESSAGE", ex);
        }

        public static void ProcessException(string p_sNote, Exception ex)
        {
            throw new Exception(p_sNote + ex.Message, ex);            
        }
    }
}
